﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cherry.Agile.Security
{
    /// <summary>
    /// 事件变化EventAgrs
    /// </summary>
    public class AuthorizationChangedEventArgs:EventArgs
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">数据变化类型</param>
        /// <param name="args">辅助参数</param>
        public AuthorizationChangedEventArgs(AuthorizationDataType type,params object[] args)
        {
            this.Type = type;
            this.Args = args;
        }

        /// <summary>
        /// 数据变化类型
        /// </summary>
        public AuthorizationDataType Type { get; private set; }

        /// <summary>
        /// 辅助参数
        /// </summary>
        public object[] Args { get; private set; }

        /// <summary>
        /// 是否处理过
        /// </summary>
        public bool Handled { get; set; }
    }

    /// <summary>
    /// 事件类型
    /// </summary>
    [Flags]
    public enum AuthorizationDataType
    {   
        /// <summary>
        /// 用户信息
        /// </summary>
        User = 1,

        /// <summary>
        /// 角色
        /// </summary>
        Role = 2,

        /// <summary>
        /// 权限
        /// </summary>
        Permission = 4,

        /// <summary>
        /// 其他
        /// </summary>
        Other = 8,

        /// <summary>
        /// 所有
        /// </summary>
        All = User| Role | Permission
    }
}
